package controllers

import (
	"read.com/admin/models"
	"read.com/admin/libs"
)

type BookreportController struct {
	BaseController
}

func (self *BookreportController) List() {
	self.Data["pageTitle"] = "书籍日报列表"
	self.display()
}

func (self *BookreportController) Table() {
	channel := self.GetString("channel")
	dateTime := self.GetString("time")
	//列表参数
	page, err := self.GetInt("page")
	if err != nil {
		page = 1
	}
	limit, err := self.GetInt("limit")
	if err != nil {
		limit = 10
	}
	export := self.GetString("export")
	if export == "1" { // 导出excel格式
		result, _,tableHead := models.GetReportDailyBookList(page,limit,channel,dateTime,export)
		libs.FormatExcel(self.Ctx.Output, result,tableHead)
	} else { // 查询
		result, total,_ := models.GetReportDailyBookList(page,limit,channel,dateTime,export)
		self.ajaxList("成功", MSG_OK, total, result)
	}
}